/* ParentBehaviorController.cpp - implementation of ParentBehaviorController class */

#include "ParentBehaviorController.h"

BaseBehavior* ParentBehaviorController::GetCurrentBehavior()
{	
	if(curPos < subBehaviors.size())	
		return subBehaviors.at(curPos);
	else
		return NULL;
}

void ParentBehaviorController::Reset()
{	
	DEBUG_PRINT("Parent Behavior Controller(%p) resetting.\n", this);
	((BehaviorController*)this)->Reset();
	curPos = 0;	
}

void ParentBehaviorController::SetCurrent(BaseBehavior* incBehavior)
{
	DEBUG_PRINT("Parent Behavior(%p) setting current hehavior(%p).\n", this, incBehavior);
	int pos = 0;
	for(std::vector<BaseBehavior*>::iterator it = subBehaviors.begin(); it != subBehaviors.end(); pos++, it++)
		if((*it) == incBehavior)
			break;
	if(pos != subBehaviors.size())	curPos = pos;
}